package lab02.test23;

import java.text.ParseException;
import java.util.Calendar;
import java.util.Scanner;

public class Test23 {
    public static void main(String[] args) throws ParseException {
        System.out.println("请输入你的生日信息(月份和日期 如：2017 10 24):");
        Scanner in=new Scanner(System.in);
        int year1=in.nextInt();
        int month1=in.nextInt();
        int day1=in.nextInt();
        Calendar calendar = Calendar.getInstance();
        calendar.set(year1,month1-1,day1);
        int week = calendar.get(Calendar.DAY_OF_WEEK);
        System.out.println("你的生日在周（从周1到周0）" + (week-1));
        int DAY_OF_YEAR1 = calendar.get(Calendar.DAY_OF_YEAR);
        calendar= Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        int month= calendar.get(Calendar.MONTH);
        int DAY_OF_MONTH = calendar.get(Calendar.DAY_OF_MONTH);
        int DAY_OF_YEAR = calendar.get(Calendar.DAY_OF_YEAR);
        if((month1-1)<month||(month==(month1-1)&&day1<DAY_OF_MONTH)){
            System.out.println("你今年的生日已过！");
        }
        else {
            System.out.println("距离你生日还有"+(DAY_OF_YEAR1-DAY_OF_YEAR));
        }
    }
}
